home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / Samples / Moofwars 1.02 / MoofWars Sprocket / •Headers / TShipSprite.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-05  |  2.0 KB  |  85 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************
  2.  
  3. TShipSprite.h
  4.  
  5. This is the class used to represent the friendly ship in the game.  Eventually,
  6. one ship class will represent both friendly and enemy ships, since the only
  7. major difference is the keyset.  A computer controlled ship could be 
  8. different.
  9.  
  10.  
  11. Author: Timothy Carroll
  12. Apple Developer Technical Support
  13. timc@apple.com
  14.  
  15. Modification History: 
  16.  
  17. 8/15/96        TMC     Initial Release
  18.  
  19. Copyright © 1996 Apple Computer, Inc., All Rights Reserved
  20.  
  21.  
  22. You may incorporate this sample code into your applications without
  23. restriction, though the sample code has been provided "AS IS" and the
  24. responsibility for its operation is 100% yours.  However, what you are
  25. not permitted to do is to redistribute the source as "DSC Sample Code"
  26. after having made changes. If you're going to re-distribute the source,
  27. we require that you make it clear in the source that the code was
  28. descended from Apple Sample Code, but that you've made changes.
  29.  
  30. *************************************************************************************/
  31.  
  32.  
  33. #ifndef _TSHIPSPRITE_
  34. #define _TSHIPSPRITE_
  35.  
  36. #pragma once
  37.  
  38. #include "TSprite.h"
  39. #include "TSpriteCollection.h"
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42. #pragma options align=power
  43. #endif
  44.  
  45.  
  46. struct TShipSpriteData
  47. {
  48.     TSpriteData spriteData;
  49.     SInt16         rotateInterval; // turning rate;
  50.     SInt16        shotInterval;   // firing rate;
  51.     TSpriteCollection *shotsGroup;   // where my shots should be added.
  52. };
  53.  
  54. typedef struct TShipSpriteData **TShipSpriteDataHandle;
  55.  
  56. class TShipSprite : public TSprite
  57. {
  58.     public:
  59.     
  60.     enum {
  61.         kSpriteType = 'SHIP'
  62.     };
  63.     
  64.     TShipSprite (TShipSpriteData *data);
  65.     ~TShipSprite (void);
  66.     
  67.     virtual void ProcessSprite (void);
  68.     virtual void Collision (TSprite *theSprite);
  69.     
  70.     protected:
  71.     SInt16 fRotateInterval;
  72.     SInt16 fRotateValue;
  73.     SInt16 fShotInterval;
  74.     SInt16 fShotValue;
  75.     SInt16 fDirection;
  76.     TSpriteCollection *fShotsGroup;
  77. };
  78.  
  79. #if PRAGMA_STRUCT_ALIGN
  80. #pragma options align=reset
  81. #endif
  82.  
  83.  
  84. #endif /* _TSHIPSPRITE_ */
  85.